home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / TranslationExtensions.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  6.5 KB  |  210 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        TranslationExtensions.h
  3.  
  4.      Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5.  
  6.      Version:    Technology:    Macintosh Easy Open 1.1
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1989-1993, 1995, 1997-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TRANSLATIONEXTENSIONS__
  18. #define __TRANSLATIONEXTENSIONS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __FILES__
  25.     #include <Files.h>
  26. #endif
  27.  
  28. #ifndef __QUICKDRAW__
  29.     #include <Quickdraw.h>
  30. #endif
  31.  
  32. #ifndef __COMPONENTS__
  33.     #include <Components.h>
  34. #endif
  35.  
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. enum {
  60.     kSupportsFileTranslation    = 1,
  61.     kSupportsScrapTranslation    = 2,
  62.     kTranslatorCanGenerateFilename = 4
  63. };
  64.  
  65.  
  66. /* better names for 4-char codes*/
  67. typedef OSType                             FileType;
  68. typedef ResType                         ScrapType;
  69. typedef unsigned long                     TranslationAttributes;
  70. enum {
  71.     taDstDocNeedsResourceFork    = 1,
  72.     taDstIsAppTranslation        = 2
  73. };
  74.  
  75.  
  76.  
  77. struct FileTypeSpec {
  78.     FileType                         format;
  79.     long                             hint;
  80.     TranslationAttributes             flags;                        /* taDstDocNeedsResourceFork, taDstIsAppTranslation*/
  81.     OSType                             catInfoType;
  82.     OSType                             catInfoCreator;
  83. };
  84. typedef struct FileTypeSpec                FileTypeSpec;
  85.  
  86. struct FileTranslationList {
  87.     unsigned long                     modDate;
  88.     unsigned long                     groupCount;
  89.                                                                 /*     unsigned long    group1SrcCount;*/
  90.                                                                 /*     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);*/
  91.                                                                 /*  FileTypeSpec    group1SrcTypes[group1SrcCount]*/
  92.                                                                 /*  unsigned long    group1DstCount;*/
  93.                                                                 /*  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);*/
  94.                                                                 /*  FileTypeSpec    group1DstTypes[group1DstCount]*/
  95. };
  96. typedef struct FileTranslationList        FileTranslationList;
  97. typedef FileTranslationList *            FileTranslationListPtr;
  98. typedef FileTranslationListPtr *        FileTranslationListHandle;
  99.  
  100.  
  101. struct ScrapTypeSpec {
  102.     ScrapType                         format;
  103.     long                             hint;
  104. };
  105. typedef struct ScrapTypeSpec            ScrapTypeSpec;
  106.  
  107. struct ScrapTranslationList {
  108.     unsigned long                     modDate;
  109.     unsigned long                     groupCount;
  110.                                                                 /*     unsigned long        group1SrcCount;*/
  111.                                                                 /*     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);*/
  112.                                                                 /*  ScrapTypeSpec        group1SrcTypes[group1SrcCount]*/
  113.                                                                 /*  unsigned long        group1DstCount;*/
  114.                                                                 /*     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);*/
  115.                                                                 /*  ScrapTypeSpec        group1DstTypes[group1DstCount]*/
  116. };
  117. typedef struct ScrapTranslationList        ScrapTranslationList;
  118. typedef ScrapTranslationList *            ScrapTranslationListPtr;
  119. typedef ScrapTranslationListPtr *        ScrapTranslationListHandle;
  120. /* definition of callbacks to update progress dialog*/
  121.  
  122. typedef long                             TranslationRefNum;
  123. /*****************************************************************************************
  124. *
  125. * This routine sets the advertisement in the top half of the progress dialog.
  126. * It is called once at the beginning of your DoTranslateFile routine.
  127. *
  128. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  129. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  130. *                            Before returning from DoTranslateFile, you should dispose
  131. *                            of the memory.  (Normally, it is in the temp translation heap
  132. *                            so it is cleaned up for you.)
  133. *
  134. * Exit:    returns            noErr, paramErr, or memFullErr
  135. */
  136. EXTERN_API( OSErr )
  137. SetTranslationAdvertisement        (TranslationRefNum         refNum,
  138.                                  PicHandle                 advertisement)                        TWOWORDINLINE(0x7002, 0xABFC);
  139.  
  140.  
  141. /*****************************************************************************************
  142. *
  143. * This routine updates the progress bar in the progress dialog.
  144. * It is called repeatedly from within your DoTranslateFile routine.
  145. * It should be called often, so that the user will get feedback if he tries to cancel.
  146. *
  147. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  148. *            progress    percent complete (0-100)
  149. *
  150. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  151. *            returns        noErr, paramErr, or memFullErr
  152. */
  153. EXTERN_API( OSErr )
  154. UpdateTranslationProgress        (TranslationRefNum         refNum,
  155.                                  short                     percentDone,
  156.                                  Boolean *                canceled)                            TWOWORDINLINE(0x7001, 0xABFC);
  157.  
  158.  
  159.  
  160. /* ComponentMgr selectors for routines*/
  161. enum {
  162.     kTranslateGetFileTranslationList = 0,                        /* component selectors*/
  163.     kTranslateIdentifyFile        = 1,
  164.     kTranslateTranslateFile        = 2,
  165.     kTranslateGetTranslatedFilename = 3,
  166.     kTranslateGetScrapTranslationList = 10,                        /* skip to scrap routines*/
  167.     kTranslateIdentifyScrap        = 11,
  168.     kTranslateTranslateScrap    = 12,
  169.     kTranslateGetScrapTranslationListConsideringData = 13
  170. };
  171.  
  172.  
  173. /* Routines to implment in a file translation extension*/
  174.  
  175.  
  176. typedef CALLBACK_API( ComponentResult , DoGetFileTranslationListProcPtr )(ComponentInstance self, FileTranslationListHandle translationList);
  177. typedef CALLBACK_API( ComponentResult , DoIdentifyFileProcPtr )(ComponentInstance self, const FSSpec *theDocument, FileType *docType);
  178. typedef CALLBACK_API( ComponentResult , DoTranslateFileProcPtr )(ComponentInstance self, TranslationRefNum refNum, const FSSpec *sourceDocument, FileType srcType, long srcTypeHint, const FSSpec *dstDoc, FileType dstType, long dstTypeHint);
  179. typedef CALLBACK_API( ComponentResult , DoGetTranslatedFilenameProcPtr )(ComponentInstance self, FileType dstType, long dstTypeHint, FSSpec *theDocument);
  180.  
  181. /* Routine to implement in a scrap translation extension*/
  182.  
  183. typedef CALLBACK_API( ComponentResult , DoGetScrapTranslationListProcPtr )(ComponentInstance self, ScrapTranslationListHandle list);
  184. typedef CALLBACK_API( ComponentResult , DoIdentifyScrapProcPtr )(ComponentInstance self, const void *dataPtr, Size dataLength, ScrapType *dataFormat);
  185. typedef CALLBACK_API( ComponentResult , DoTranslateScrapProcPtr )(ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr, Size srcDataLength, ScrapType srcType, long srcTypeHint, Handle dstData, ScrapType dstType, long dstTypeHint);
  186.  
  187.  
  188.  
  189.  
  190. #if PRAGMA_STRUCT_ALIGN
  191.     #pragma options align=reset
  192. #elif PRAGMA_STRUCT_PACKPUSH
  193.     #pragma pack(pop)
  194. #elif PRAGMA_STRUCT_PACK
  195.     #pragma pack()
  196. #endif
  197.  
  198. #ifdef PRAGMA_IMPORT_OFF
  199. #pragma import off
  200. #elif PRAGMA_IMPORT
  201. #pragma import reset
  202. #endif
  203.  
  204. #ifdef __cplusplus
  205. }
  206. #endif
  207.  
  208. #endif /* __TRANSLATIONEXTENSIONS__ */
  209.  
  210.